﻿using System;
using System.Collections.Generic;
using System.Text;

namespace AbyssCombatLogger
{
    /// <summary>
    /// String Number Pair, class
    /// </summary>
    /// <typeparam name="T"></typeparam>
    /// 
    [Serializable]
    public class ParsedLogEvent //where T : IComparable<T>
    {
        public ParsedLogEvent()
        {
        }  
        public ParsedLogEvent(string actor_or_player, string sTarget, long iDamageOrHealing, DateTime timeStamp)//, DateTime timeOfOccurrence)
        {
            if (actor_or_player == null)
                throw new Exception("Parsed Event Constructor Error. Actor null.");
            //if (sTarget == null)
            this.actorIsPet = false;

            this.actor = actor_or_player;
            this.target = sTarget;
            this.damageOrHealing = iDamageOrHealing;
            this.spell = null;
            this.timeStamp = timeStamp;
        }

        public ParsedLogEvent(string actor_or_player, bool actor_is_pet, string sTarget, long iDamageOrHealing, string spell, DateTime timeStamp)//, DateTime timeOfOccurrence)
        {
            if (actor_or_player == null)
                throw new Exception("Parsed Event Constructor Error. Actor null.");
            //if (sTarget == null)
            this.actorIsPet = actor_is_pet;

            this.actor = actor_or_player;
            this.target = sTarget;
            //this.timeStamp = timeOfOccurrence;
            this.damageOrHealing = iDamageOrHealing;
            this.spell = spell;
            this.timeStamp = timeStamp;
        }

        private bool actorIsPet = false;

        public bool ActorIsPet
        {
            get { return actorIsPet; }
            set { actorIsPet = value; }
        }

        private String target = null;
        private string actor = null;
        private string spell = null;
        private DateTime timeStamp = DateTime.MinValue;

        public DateTime TimeStamp
        {
            get { return timeStamp; }
            set { timeStamp = value; }
        }

        public string Spell
        {
            get { return spell; }
            set { spell = value; }
        }
        //string definateEnemyName = "";

        //public string DefinateEnemyName
        //{
        //    get { return definateEnemyName; }
        //    set { definateEnemyName = value; }
        //}

        public string Actor
        {
            get { return actor; }
            set { actor = value; }
        }
        public String Target
        {
            get { return target; }
            set { target = value; }
        }
        private long damageOrHealing;

        public int AmountInt
        {
            get { return (int)damageOrHealing; }
            set { damageOrHealing = value; }
        }
        public long Amount
        {
            get { return damageOrHealing; }
            set { damageOrHealing = value; }
        }
        //private DateTime timeStamp;

        //public DateTime TimeStamp
        //{
        //    get { return timeStamp; }
        //    set { timeStamp = value; }
        //}
    }

    public class ParsedEventComparer : IComparer<ParsedLogEvent> 
    {

        public int Compare(ParsedLogEvent x, ParsedLogEvent y)
        {
            return (Convert.ToInt64(x.AmountInt)).CompareTo(y.AmountInt);
        }
    }

    //[Serializable]
    //public class ParsedLogEvent //: ParsedEvent<int>
    //{
    //    public ParsedLogEvent(string actor, string sTarget, int iDamageOrHealing, string spell, DateTime timeStamp)//, DateTime timeOfOccurrence)
    //    {
    //        if (actor == null || actor == "")
    //            throw new Exception("Actor null exception. Check your parsing skills and try again.");
    //        if (sTarget == null || sTarget == "")
    //            throw new Exception("Target null exception. Constructor error.");
    //        this.actorFullName = actor;
    //        this.target = sTarget;
    //        //this.timeStamp = timeOfOccurrence;
    //        this.damageOrHealing = iDamageOrHealing;
    //        this.spellCast = spell;
    //        this.timeStamp = timeStamp;
    //    }
    //    private String target = null;
        
    //    private DateTime timeStamp = DateTime.MinValue;

    //    public DateTime TimeStamp
    //    {
    //        get { return timeStamp; }
    //        set { timeStamp = value; }
    //    }

    //    public string Spell
    //    {
    //        get { return spellCast; }
    //        set { spellCast = value; }
    //    }
    //    //string definateEnemyName = "";

    //    //public string DefinateEnemyName
    //    //{
    //    //    get { return definateEnemyName; }
    //    //    set { definateEnemyName = value; }
    //    //}

    //    public string Actor
    //    {
    //        get { return actorFullName; }
    //        set { actorFullName = value; }
    //    }
    //    public String Target
    //    {
    //        get { return target; }
    //        set { target = value; }
    //    }
    //    private int damageOrHealing;
    //    private string actorFullName;

    //    public string ActorFullName
    //    {
    //        get { return actorFullName; }
    //        set { actorFullName = value; }
    //    }
    //    private string spellCast;

    //    public int Amount
    //    {
    //        get { return damageOrHealing; }
    //        set { damageOrHealing = value; }
    //    }

    //    //private DateTime timeStamp;

    //    //public DateTime TimeStamp
    //    //{
    //    //    get { return timeStamp; }
    //    //    set { timeStamp = value; }
    //    //}
    //    //public ParsedEvent_Int(string sPlayerOrMobName, string sTarget, int iDamageOrHealing, string spellName, string nothing)//, DateTime timeOfOccurrence)
    //    //{
    //    //    //this.TimeStamp = timeOfOccurrence;
    //    //    this.Target = sTarget;
    //    //    this.Actor = sPlayerOrMobName;
    //    //    this.Amount = iDamageOrHealing;
    //    //    this.Spell = spellName;
    //    //}


    //    //ParsedLogEvent(actorFullName, tar, amount, spellCast);
    //    public ParsedLogEvent(string actorFullName, string tar, int amount, string spellCast)
    //    {
    //        if (actorFullName == null || actorFullName == "")
    //            throw new Exception("Actor null exception. Check your parsing skills and try again.");

    //        // TODO: Complete member initialization
    //        this.actorFullName = actorFullName;
    //        this.target = tar;
    //        this.Amount = amount;
    //        this.spellCast = spellCast;
    //    }
    //}
    
    //[Serializable]
    //public class ParsedEvent_Long : ParsedEvent<long>
    //{
    //    public ParsedEvent_Long()
    //    {
    //        Amount = 0;
    //    }
    //    public ParsedEvent_Long(string sPlayerOrMobName, string sTarget, long damageOrHealing)//, DateTime timeOfOccurrence)
    //    {
    //        //this.TimeStamp = timeOfOccurrence;
    //        this.Target = sTarget;
    //        this.Actor = sPlayerOrMobName;
    //        this.Amount = damageOrHealing;
    //    }
    //}

}
